package com.translate.web.constant;


/**
 * redis key 常量
 * 
 * @author 111
 *
 */
public class RedisConstant {

	public static final String MODULE_CLASS_DATA = "module-class:";
	
	public static final String MODULE_COUNT_NUMBER = "module-count:";
	
	public static final String MODULE_SEARCH_COUNT_NUMBER = "module-s-count:";
	
	public static final String MODULE_SEARCH_LIST= "module-s-list:";
	
	public static final String MODULE_List = "module-list:";
	
	public static final String SMS_CODE = "sms:";
	
	public static final String EMAIL_CODE = "email:";
	
	public static final String USER_ID = "user-id:";
	
	public static final String MOBILE_CODE = "mobile-code:";
	
	public static final String MATCH_DATA = "match-data:";
	
	public static final String TABLE_COLUMN_INFO = "m-table-column:";

	public static final String CERTIFICATE_KEY = "crm:";

	public static final String TABLE_COMMENT = "m-table-comment:";

	public static final String USER_PAGE = "userpage:";
	
	public static final String DEPARTMENT_PAGE = "departmentpage:";

	public static final String CUSTOMER_IDS = "cs:";
	
	public static final String CUSTOMER_SEA_ID = "cse:";
	
	public static final String CUSTOMER_NUMBER = "csn:";

	public static final String CUSTOMER_ID = "cid:";

	
	public static final String CUSTOMER_ACCESS_ID = "cassid:";
	
	public static final String CUSTOMER_FOLLOW_ID = "cf:";
	
	public static final String USERS_ID = "uids:";

	
	public static final String PRODUCTS_LIST = "p-list:";
	
	public static final String ORDER_SINGLE = "order:";
	
	public static final String ORDER_DISCOUNT_SINGLE = "order-d:";
	
	public static final String ORDER_PIC_SINGLE = "order-pic:";
	
	public static final String RECEIVABLES_ID = "receivables-id:";
	
	public static final String CONTRACT_ID = "contract-id:";
	
	public static final String CONTRACT_PIC = "contract-pic:";

	public static final String ROLE_MENU_RELATION_IDS = "roleMenuRelation-id:";
	
	
	public static final String MENU_KEY = "user-id:";
	
	public static final String BANNER_KEY = "banner:";
	
	
	

	/**
	 * 
	 */
	public static final String ADMINROLERELATIONS_KEY = "adminRoleRelations:";
	
	
	
	/**
	 * 
	 */
	public static final String PAYMENT_APPROVAL_KEY = "payment-approval:";
	
	
	/**
	 * 
	 */
	public static final String NUMBER_OF_ASSOCIATED_ID_CLASSIFICATION_OBTAINED = "noaico:";
	
	/**
	 * 
	 */
	public static final String NUMBER_OF_ASSOCIATED_ID_CLASSIFICATION_OBTAINED_TO_LOCK = "noaicol:";
	
	
	/**
	 * 
	 */
	public static final String LOOK_NUMBER = "look:";
	
	public static final String CLIENT_ANALYSIS = "clientAnalysis:";
	
	
	/**
	 * 部门分析
	 */
	public static final String CUSTOMER_LABEL = "customer-label:";
	
	
	
	/**
	 * 角色权限
	 */
	public static final String HIGH_SE = "hign-sea:";
	
	
	/**
	 * 角色权限
	 */
	public static final String GOODS_IMAGE_LIST = "goods-image:";
	
	
	/**
	 * 服务介绍
	 */
	public static final String SERVICE_INTRODUCTION = "sd:";
	
	/**
	 * 活动
	 */
	public static final String ACTIVITY_LIST = "activity:";
	
	/**
	 * 服务价格
	 */
	public static final String SERVICE_CONF = "service-conf:";
	
	
	/**
	 * 充值奖励
	 */
	public static final String PRE_STORE_KEY = "pre-store:";
	
	/**
	 * 身份
	 */
	public static final String IDENTITY_KEY = "identity:";
	
	/**
	 * 服务类型
	 */
	public static final String SERVER_TYPE = "service-type:";
	
	
	/**
	 * 支付类型
	 */
	public static final String PAY_TYPE = "pay-type:";
	
	
	/**
	 * 科学可视化
	 */
	public static final String SCIENTIFIC_KEY = "scientific:";
	
	
	/**
	 * 活动文章
	 */
	public static final String ACTIVITY_ARTICLE = "a-article:";
	
	/**
	 * 服务文章
	 */
	public static final String SERVICE_ARTICLE = "s-article:";

	
	/**
	 * 服务文章
	 */
	public static final String NEWS_ARTICLE = "n-article:";
	

	/**
	 * 案例
	 */
	public static final String EXAMPLE_DATA_KEY = "example:";
	

	/**
	 * 案例图片
	 */
	public static final String EXAMPLE_PIC_KEY = "example-pic:";
	
	
	/**
	 * 案例图片
	 */
	public static final String SERVICCE_MANGER_KEY = "service-manager:";
	
	
	/**
	 * 团队奖励
	 */
	public static final String TEAM_SIGN_KEY = "team-sign-manager:";
	

	/**
	 * 新闻
	 */
	public static final String NEWS_KEY = "news:";
	
	/**
	 * id -userId
	 */
	public static final String DATA_ORDER = "d-o:";
	
	
	/**
	 * id -userId
	 */
	public static final String MANUSCRIPT_FILE = "m-f:";

	
	/**
	 * id -userId
	 */
	public static final String ORDER_LOG = "o-l:";
	
	
	/**
	 * id -userId
	 */
	public static final String TEAM_ID = "t-i:";
	
	/**
	 * id -userId
	 */
	public static final String TEAM_SEARCH_ID = "t-si:";
	
	
	/**
	 * id -userId
	 */
	public static final String TEAM_SEARCH = "t-s:";
	
	public static final String ACADEMIC_RESOURCES = "academic-resources";

	public static final String PAY_ORDER_INFO = "pay-order";
	
	public static final String PAY_RECHARGE_INFO = "pay-recharge";
	
	public static final String TRANSLATE_DATA_ID = "translate-id";
	
	
	public static final String NVITATION_REWARDS_CONF = "nvitation-conf";
	
	public static final String TRANSLATORS_ASSOCIATION = "TranslatorsAssociation:";
	
	
	public static final String SECONDARY_SERVICETYPE_KEY = "secondaryServiceType:";

	
	public static final String getTranslateKey(int id, long userId) {
		
		return TRANSLATE_DATA_ID + id + '-' + userId;
	}
	
	public static final String getPayRechargeKey(int id, long userId) {
		
		return PAY_RECHARGE_INFO + id + '-' + userId;
	}
	
	public static final String getPayOrderInfoKey(int id, long userId) {
		
		return PAY_ORDER_INFO + id + '-' + userId;
		
	}
	
	public static String getAcademicKey(Integer id) {
		return ACADEMIC_RESOURCES + id;
	}
	
	/**
	 * teamId -teamId
	 * @param ids
	 * @return
	 */
	public static String getTeamSelectBySearch(Integer id) {
		return TEAM_SEARCH_ID + id;
	}
	
	/**
	 * teamId -teamId
	 * @param ids
	 * @return
	 */
	public static String getTeamBySearch(Integer id, String greoupName) {
		return TEAM_SEARCH + id + greoupName;
	}
	
	
	
	/**
	 * teamId -teamId
	 * @param ids
	 * @return
	 */
	public static String getTeamKey(long id) {
		return TEAM_ID + id;
	}
	
	/**
	 * teamId -teamId
	 * @param ids
	 * @return
	 */
	public static String getTeamKey(long id, long userId) {
		return TEAM_ID + id + "-" + userId;
	}
	
	/**
	 * 订单
	 * @param ids
	 * @return
	 */
	public static String getOrderLogKey(int id, long userId) {
		return ORDER_LOG + id + '-' + userId;
	}
	
	/**
	 * 订单
	 * @param ids
	 * @return
	 */
	public static String getManuscriptKey(int id, long userId) {
		return MANUSCRIPT_FILE + id + '-' + userId;
	}
	
	/**
	 * 订单
	 * @param ids
	 * @return
	 */
	public static String getOrderDeteilKey(int id, long userId) {
		return DATA_ORDER + id + '-' + userId;
	}
	
	/**
	 * 活动文章
	 * @param ids
	 * @return
	 */
	public static String examplePicKeys(int[] ids) {
		return EXAMPLE_PIC_KEY + getCacheKeyByData(ids, EXAMPLE_PIC_KEY);
	}
	
	/**
	 * 活动文章
	 * @param ids
	 * @return
	 */
	public static String getActivityId(int id) {
		return ACTIVITY_ARTICLE + id;
	}
	
	/**
	 * 服务文章
	 * @param ids
	 * @return
	 */
	public static String getServiceById(int id) {
		return SERVICE_ARTICLE + id;
	}
	
	/**
	 * 新闻文章
	 * @param ids
	 * @return
	 */
	public static String getNewsById(int id) {
		return NEWS_ARTICLE + id;
	}
	
	
	
	/**
	 * 客户分析
	 * @param ids
	 * @return
	 */
	public static String getImageKey(int goodsId) {
		return GOODS_IMAGE_LIST + goodsId;
	}
	
	
	/**
	 * 客户分析
	 * @param ids
	 * @return
	 */
	public static String getHignSea() {
		return HIGH_SE;
	}
	
	/**
	 * 客户分析
	 * @param ids
	 * @return
	 */
	public static String getCustomerLabelKey() {
		return CUSTOMER_LABEL;
	}
	
	
	/**
	 * 部门分析
	 */
	public static final String DEPARTMENT_ID = "department:";
	
	/**
	 * 客户分析
	 * @param ids
	 * @return
	 */
	public static String getDepartmentByIdKey(int departmentId) {
		return DEPARTMENT_ID + departmentId;
	}
	

	/**
	 * 部门分析
	 */
	public static final String TOP_DEPARTMENT = "department-top:";
	
	/**
	 * 客户分析
	 * @param ids
	 * @return
	 */
	public static String getTopDepartmentKey() {
		return TOP_DEPARTMENT;
	}
	
	
	/**
	 * 部门分析
	 */
	public static final String DEPARTMENT = "department:";
	
	/**
	 * 客户分析
	 * @param ids
	 * @return
	 */
	public static String getDepartmentKey() {
		return DEPARTMENT;
	}
	
	/**
	 * 客户分析
	 * @param ids
	 * @return
	 */
	public static String getClientAnalysisKey(int commentId) {
		return CLIENT_ANALYSIS + commentId;
	}
	
	
	/**
	 * 订单审批
	 * @param ids
	 * @return
	 */
	public static String getLookNumberKey(int commentId) {
		return LOOK_NUMBER + commentId;
	}
	
	
	
	
	/**
	 * 订单审批
	 * @param ids
	 * @return
	 */
	public static String getAssociatedIdClassificationObtainedsLookByKey(Integer[] ids) {
		return getCacheKeyByData(ids, NUMBER_OF_ASSOCIATED_ID_CLASSIFICATION_OBTAINED_TO_LOCK);
	}
	
	
	/**
	 * 订单审批
	 * @param ids
	 * @return
	 */
	public static String getAssociatedIdClassificationObtainedsByKey(Integer[] ids) {
		return getCacheKeyByData(ids, NUMBER_OF_ASSOCIATED_ID_CLASSIFICATION_OBTAINED);
	}
	
	
	
	
	/**
	 * 订单审批
	 * @param ids
	 * @return
	 */
	public static String getPaymentApprovalByKey(int userId) {
		return  PAYMENT_APPROVAL_KEY + userId;
	}
	
	
	/**
	 * 
	 */
	public static final String ORDER_APPROVAL_KEY = "order-approval:";
	
	/**
	 * 订单审批
	 * @param ids
	 * @return
	 */
	public static String getOrderApprovalByKey(int userId) {
		return  ORDER_APPROVAL_KEY + userId;
	}
	
	
	/**
	 * 后台权限菜单关系
	 * @param ids
	 * @return
	 */
	public static String getAdminRoleRelations(int userId) {
		return  ADMINROLERELATIONS_KEY + userId;
	}
	
	/**
	 * 后台权限菜单关系
	 * @param ids
	 * @return
	 */
	public static String getMenusKey(int userId) {
		return  MENU_KEY + userId;
	}
	
	
	
	/**
	 * 后台角色关系
	 * @param ids
	 * @return
	 */
	public static String getRoleMenuRelationKey(Integer[] ids) {
		return getCacheKeyByData(ids, ROLE_MENU_RELATION_IDS);
	}
	
	/**
	 * 合同图片
	 * @param id
	 * @return
	 */
	public static String getContractPicKey(Integer id) {
		return CONTRACT_PIC + id;
	}

	/**
	 * 合同
	 * @param id
	 * @return
	 */
	public static String getContractKey(Integer id) {
		return CONTRACT_ID + id;
	}

	/**
	 * 回款
	 * @param id
	 * @return
	 */
	public static String getReceivablesKey(Integer id) {
		return RECEIVABLES_ID + id;
	}
	

	/**
	 * 商品详情及折扣信息
	 * @param id
	 * @return
	 */
	public static String getOrderPicKey(Integer id) {
		return ORDER_PIC_SINGLE + id;
	}

	/**
	 * 商品详情及折扣信息
	 * @param id
	 * @return
	 */
	public static String getOrderDiscounttKey(Integer id) {
		return ORDER_DISCOUNT_SINGLE + id;
	}
	

	public static String getOrdertKey(Integer id) {
		return ORDER_SINGLE + id;
	}
	
	public static String getProductListKey(Integer[] ids) {
		return getCacheKeyByData(ids, PRODUCTS_LIST);
	}

	/**
	 * CUSTOMER_IDS
	 * 跟进者信息
	 * @param key
	 * @return
	 */
	public static String getKeyByUserIds(Integer[] integers) {
		return getCacheKeyByData(integers, USERS_ID);
	}
	
	/**
	 * CUSTOMER_IDS
	 * 客户公海客户数量key
	 * @param key
	 * @return
	 */
	public static String getKeyByCustomerFollowID(int key) {
		return CUSTOMER_FOLLOW_ID + key;
	}
	
	
	/**
	 * CUSTOMER_IDS
	 * 客户公海客户数量key
	 * @param key
	 * @return
	 */
	public static String getKeyByCustomerAccessID(int key) {
		return CUSTOMER_ACCESS_ID + key;
	}
	
	

	/**
	 * CUSTOMER_IDS
	 * 客户公海客户数量key
	 * @param key
	 * @return
	 */
	public static String getKeyByCustomerById(int key) {
		return CUSTOMER_ID + key;
	}
	
	/**
	 * CUSTOMER_IDS
	 * 客户公海客户数量key
	 * @param key
	 * @return
	 */
	public static String getKeyByCustomerSeaNumber(int key) {
		return CUSTOMER_NUMBER + key;
	}
	
	
	
	/**
	 * CUSTOMER_IDS
	 * 客户公海key
	 * @param key
	 * @return
	 */
	public static String getCustomerSeaKey(int key) {
		return CUSTOMER_SEA_ID + key;
	}
	
	

	/**
	 * CUSTOMER_IDS
	 * 客户key
	 * @param key
	 * @return
	 */
	public static String getCustomerKey(Integer[] integers) {
		return getCacheKeyByData(integers, CUSTOMER_IDS);
	}
	
	/**
	 * CUSTOMER_IDS
	 * 客户key
	 * @param key
	 * @return
	 */
	public static String getDepartment(int key) {
		return DEPARTMENT_PAGE + key;
	}
	
	/**
	 * 通讯录key
	 * @param key
	 * @return
	 */
	public static String getCommunication(int key) {
		return USER_PAGE + key;
	}
	
	public static String getTableCommentKey(String key) {
		return TABLE_COMMENT + key;
	}
	
	public static String getCertificateKey(int id) {
		return CERTIFICATE_KEY + id;
	}
	
	
	public static String getTableColumnInfoKey(String key) {
		return TABLE_COLUMN_INFO + key;
	}
	
	
	public static String getMatchDataKey() {
		return MATCH_DATA;
	}
	
	
	public static String getSmsByKey(String mobile) {
		return MOBILE_CODE + mobile;
	}
	
	public static String getEmailKey(String email) {
		return EMAIL_CODE + email;
	}
	
	
	
	public static String getModuleCountSearchKey(Integer pageNum, Integer classId, String moduleName) {
		return MODULE_SEARCH_COUNT_NUMBER + pageNum + classId + moduleName;
	}
	
	public static String getModuleListSearchKey(Integer pageNum, Integer classId, String moduleName) {
		return MODULE_SEARCH_LIST + pageNum + classId + moduleName;
	}
	

	public static String getUserIdKey(int id) {
		return MODULE_List + id;
	}
	
	
	public static String getModuleListKey(int page) {
		return MODULE_List + page;
	}
	
	private static String getCacheKeyByData(Integer[] ids, String key) {

		String str = new String(key).concat("-");

		for (int i = 0; i < ids.length; i++) {
			str = str.concat(String.valueOf(ids[i]));
		}

		return str.substring(0, str.length() - 1);
	}

	
	private static String getCacheKeyByData(int[] ids, String key) {

		String str = new String(key).concat("-");

		for (int i = 0; i < ids.length; i++) {
			str = str.concat(String.valueOf(ids[i]));
		}

		return str.substring(0, str.length() - 1);
	}
}